import 'package:flutter/material.dart';

import 'index_item_widget.dart';
import 'info_data.dart';

class IndexInfo extends StatelessWidget {
  final bool showTitle;
  final List<InfoItem> dataList;

  const IndexInfo(
      {super.key, this.showTitle = false, this.dataList = infoData});

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        if (showTitle)
          Container(
            alignment: Alignment.centerLeft,
            padding: const EdgeInsets.only(left: 10),
            child: const Text('最新资讯',
                style: TextStyle(
                    color: Colors.black, fontWeight: FontWeight.bold)),
          ),
        Column(
          children: dataList.map((item) => IndexInfoItem(data: item)).toList(),
        )
      ],
    );
  }
}
